Get Client Sorted Servers API
POST /getClientSortedServers
Description
This API endpoint retrieves a list of client servers sorted by a specified parameter and sorting order.
Request Body
The request uses GraphQL to perform the getClientSortedServers
query, which requires two variables: sortBy
and parameter
.
Query:
query getClientSortedServers ($sortBy: String!, $parameter: String!) {
getClientSortedServers (sortBy: $sortBy, parameter: $parameter) {
id
hostName
publicIp
city
country
description
continent
connectedUserCount
congestionLevel
hero
spot
zeus
bridgeIp
bridgeCountry
}
}
GraphQL Variables:
{
"sortBy": "connectedUserCount",
"parameter": "asc"
}
Example Request:
curl --location '' \
--header 'Content-Type: application/json' \
--data '{"query":"query getClientSortedServers ($sortBy: String!, $parameter: String!) {\n getClientSortedServers (sortBy: $sortBy, parameter: $parameter) {\n id\n hostName\n publicIp\n city\n country\n description\n continent\n connectedUserCount\n congestionLevel\n hero\n spot\n zeus\n bridgeIp\n bridgeCountry\n }\n}","variables":{"sortBy":"connectedUserCount","parameter":"asc"}}'
Parameters
sortBy
: The field by which to sort the client servers (e.g.,connectedUserCount
,publicIp
).parameter
: The sorting order, eitherasc
(ascending) ordesc
(descending).
Response:
-
Success (200 OK):
- The response includes a list of client servers sorted based on the provided
sortBy
field andparameter
.
{
"data": {
"getClientSortedServers": [
{
"id": 1,
"hostName": "client-server-01",
"publicIp": "203.0.113.10",
"city": "Los Angeles",
"country": "USA",
"description": "Main client server",
"continent": "North America",
"connectedUserCount": 100,
"congestionLevel": "Low",
"hero": true,
"spot": false,
"zeus": true,
"bridgeIp": "192.168.1.10",
"bridgeCountry": "USA"
},
{
"id": 2,
"hostName": "client-server-02",
"publicIp": "203.0.113.20",
"city": "Chicago",
"country": "USA",
"description": "Secondary client server",
"continent": "North America",
"connectedUserCount": 200,
"congestionLevel": "Moderate",
"hero": false,
"spot": true,
"zeus": false,
"bridgeIp": "192.168.1.20",
"bridgeCountry": "USA"
}
// Additional client servers sorted by the specified parameters...
]
}
} - The response includes a list of client servers sorted based on the provided
-
Error (4XX/5XX):
- If there is an issue with the sorting parameters or server errors, the response will include an error message and status code.
Note:
Make sure to provide valid sortBy
and parameter
values. The API expects sortBy
to be a valid field name and parameter
to be either asc
or desc
. Ensure the GraphQL server can handle sorting based on the specified parameters.